Conversation
- Making it run on js files - Making it not autoinsert angular brackets
| | Text s -> s | ||
| | Variable s -> "{{" + s + "}}" | ||
| | Variable s -> s | ||
|
|
There was a problem hiding this comment.
If in both cases we return the input, this function isn't really doing anything.
In C# this function would be kinda like:
enum LocalizationSourcePartType { Text, Variable }
string deTag(LocalizationSourcePart t)
{
if (t.LocalizationSourcePartType == LocalizationSourcePartType.Text) {
var s = (string)t;
return s;
}
if (t.LocalizationSourcePartType == LocalizationSourcePartType.Variable)
{
var s = (string)t;
return s;
}
throw new Exception("This can never be hit because of the enum values");
}
There was a problem hiding this comment.
So, it still does map a LocalizationSourcePart to either its Text or Variable property. Is there a more elegant way to do that?
There was a problem hiding this comment.
@distinctdan The more I look at it, I think this function is actually required to appease the compiler's type checker. Even thought a LocalizationSourcePart is effectively a string, you still need a mapping function to String. The name deTag isn't really appropriate though.
There was a problem hiding this comment.
I would just call is asString or stringify or something (because ToString is already a default method in .NET which will return the type name here I believe.
There was a problem hiding this comment.
Yeah, I'd agree. I'm thinking I'll leave it alone for now since we're wanting to make some significant revisions to the compiler anyways in the future as well.
| open Ids.Localization.Parsers.XliffGenerator.XliffGenerator | ||
|
|
||
| let supportedFileTypes = new System.Text.RegularExpressions.Regex("htm|html|js") | ||
|
|
There was a problem hiding this comment.
Consider adding open System.Text.RegularExpfessions a few lines up to avoid inline namespaces.
No description provided.